<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
</head>
<body>
		<div id="app">
			<label for="uname">用户名:</label><input type="text" id="uname" v-model.lazy="uname" />{{tip}}
		</div>
		
		
		<script src="js/v2.6.10/vue.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			let myApp = new Vue({
				el:'#app',
				data:{
					uname:'',
					tip:''
				},
				methods:{
					checkuname(val){
						let that = this
						// console.log('xxxxx')
						setTimeout(function(){
							if(val === 'admin'){
								that.tip = '该用户已经存在，请更换用户名'
							}else{
								that.tip = '该用户名可以使用'
							}
						},2000)
					}
				},
				computed:{},
				watch:{
					uname(val){
						this.checkuname(val)
						this.tip = '正在验证中...'
					}
				}
			})
			
		</script>
</body>
</html>